package cn.lg.soar.core.config;

import cn.lg.soar.core.util.RunnerShowInfo;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Swagger
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Configuration
@ConditionalOnProperty(name = "lg.swagger.enabled", havingValue = "true")
public class SoarSwaggerConfigurer extends SwaggerConfigurerBase{

    @Bean
    public GroupedOpenApi soar(){
        return GroupedOpenApi.builder()
                .group("soar")
                .packagesToScan("cn.lg.soar")
                .pathsToMatch("/**")
                .build();
    }

    public SoarSwaggerConfigurer() {
        RunnerShowInfo.showUrl("Swagger 文档", "/doc.html");
    }

}
